package com.example.holes;

import java.util.ArrayList;

import android.graphics.Bitmap;

public class Mole01_Turtle extends Mole {
	public Mole01_Turtle(int holeNum, ArrayList<Bitmap> images, int imageIndex, float timeMod){
		super(holeNum, images, imageIndex);
		setStats(timeMod);
	}
	
	private void setStats(float timeMod){
		health = 2;
		lifespan = (int)(Global.UPS * 3.5 * timeMod);
		attack = 15;
		points = 20;
	}
	
	@Override
	public int timeUp() {
		if (lifespan == 0)
			return 0; // yes
		else
			return -1; // no
	}
	
	@Override
	// returns true if dead
	public int attack(int attack){
		health -= attack;
		if (health <= 0)
			return 1; // killed
		else
			return 0; // damaged
	}
	
	@Override
	public void setImage(ArrayList<Bitmap> images, int imageIndex){
		orig = images.get(imageIndex);
		// 2nd row: 80% width, 80% height
		if (row == 2){
			orig = Bitmap.createScaledBitmap(orig,(int)(orig.getWidth()*0.80), (int)(orig.getHeight()*0.80), false);
		}
		// 3rd row: 60% width, 60% height
		else if (row == 3){
			orig = Bitmap.createScaledBitmap(orig,(int)(orig.getWidth()*0.60), (int)(orig.getHeight()*0.60), false);
		}
	}

	// ==============
	//     UPDATE in super
	// ==============

	// ==============
	//     DRAW in super
	// ==============
	
	// gives the position of the mole's image from input hole number
	@Override
	public void setImagePosition(int holeNum){
		switch (holeNum) {
			case 0:	row = 1;
					left = 174;
					top = 297;
					break;
			case 1:	row = 1;
					left = 355;
					top = 297;
					break;
			case 2:	row = 1;
					left = 536;
					top = 297;
					break;
			case 3:	row = 2;
					left = 205;
					top = 190;
					break;
			case 4:	row = 2;
					left = 364;
					top = 190;
					break;
			case 5:	row = 2;
					left = 525;
					top = 190;
					break;
			case 6:	row = 3;
					left = 229;
					top = 115;
					break;
			case 7:	row = 3;
					left = 372;
					top = 115;
					break;
			case 8:	row = 3;
					left = 515;
					top = 115;
					break;
		}
	}
}
